| API Documentation |  |

- MAIN PAGE
- NAMESPACES
- CLASSES

Texture.h
1 // Texture.h
3 //
5
6 namespace nkGraphics
7 {
11 class Texture : public ShaderResource, public nkExport::Exportable
12 {
13 public :
14
18 virtual ~Texture () ;
19
23 TextureCpuDataDescriptor* getCpuData () const ;
27 unsigned int getCpuSliceCount () const ;
31 bool isFromFile () const ;
35 bool isGammaCorrected () const ;
39 bool isBackBufferTex () const ;
43 TEXTURE_TYPE getTexType () const ;
47 TEXTURE_RENDER_FLAG getRenderFlag () const ;
51 unsigned int getNeededMipsForSize () const ;
55 virtual int getWidth () const = 0 ;
59 virtual int getHeight () const = 0 ;
63 virtual int getDepthOrArraySize () const = 0 ;
67 virtual unsigned int getMipLevels () const = 0 ;
71 virtual FORMAT getTextureFormat () const = 0 ;
75 virtual BUFFER_CPU_ACCESS_FLAG getCpuAccessRights () const = 0 ;
79 virtual BUFFER_USAGE getTextureUsage () const = 0 ;
83 virtual BUFFER_BIND_FLAG getTextureBinding () const = 0 ;
87 virtual RESOURCE_MISC_FLAG getMiscFlag () const = 0 ;
91 virtual unsigned int getSampleCount () const = 0 ;
95 virtual unsigned int getSampleQuality () const = 0 ;
99 virtual bool getAutoMipGeneration () const = 0 ;
100
101 // Setters
125 void setCpuData (const ResourceCpuDataDescriptor& data) ;
160 void addCpuDataSlice (const nkMemory::BufferView<>& data, unsigned int byteOffset = 0u, unsigned int rowByteSize = 0u, unsigned int sliceByteSize = 0u) ;
174 void addCpuDataSliceCopy (const nkMemory::BufferView<>& data, unsigned int byteOffset = 0u, unsigned int rowByteSize = 0u, unsigned int sliceByteSize = 0u) ;
187 void addCpuDataSliceForward (nkMemory::Buffer&& data, unsigned int byteOffset = 0u, unsigned int rowByteSize = 0u, unsigned int sliceByteSize = 0u) ;
199 void addCpuDataSliceRelativeToLast (unsigned int byteOffset = 0u, unsigned int rowByteSize = 0u, unsigned int sliceByteSize = 0u) ;
205 void setBackBufferTex (bool value) ;
225 void setFromImage (const nkImages::ImageView& image) ;
236 void setFromImageCopy (const nkImages::ImageView& image) ;
247 void setFromImageForward (nkImages::Image&& image) ;
252 virtual void freeCpuData () ;
263 virtual void setGammaCorrected (bool value) ;
264 virtual void setPath (nkMemory::StringView value) override ;
278 virtual void setFromExternalResource (const TextureExternalData& data) = 0 ;
282 virtual void setWidth (unsigned int width) = 0 ;
286 virtual void setHeight (unsigned int height) = 0 ;
290 virtual void setDepthOrArraySize (unsigned int depth) = 0 ;
296 virtual void setMipLevels (unsigned int value) = 0 ;
300 virtual void setTextureFormat (FORMAT format) = 0 ;
306 virtual void setCpuAccessRights (BUFFER_CPU_ACCESS_FLAG rights) = 0 ;
310 virtual void setTextureUsage (BUFFER_USAGE usage) = 0 ;
314 virtual void setTextureBinding (BUFFER_BIND_FLAG binding) = 0 ;
318 virtual void setAutoMipGeneration (bool value) = 0 ;
324 virtual void copyParams (const Texture& other) = 0 ;
328 void setTextureFormatFromString (nkMemory::StringView str) ;
329
339 void setMightManuallyGenerateMip (bool value) ;
343 virtual void prepareAsTexture2d () ;
347 virtual void prepareAsCubemap () ;
351 virtual void prepareAsTexture3d () ;
357 virtual void setRenderFlag (TEXTURE_RENDER_FLAG value) ;
365 virtual void generateMipChain (unsigned int fromMip = 0) = 0 ;
366
377 nkImages::Image convertToImage (int mip, int sliceOrArrayIndex) ;
385 virtual MapResult map (const MapRequestDescriptor& requestDesc) = 0 ;
393 virtual void unmap (const UnmapRequestDescriptor& requestDesc) = 0 ;
402 virtual void gpuCopyFrom (Texture& other, const ResourceGpuCopyDescriptor& descriptor) = 0 ;
403
404 // Import / Export
405 virtual void exportClassToTree (nkExport::Node* rootNode) override ;
406 virtual void importClassFromTree (nkExport::Node* rootNode) override ;
407
408 public :
409
410 // Statics
418 static nkMemory::UniquePtr<Texture> create (System* system = nullptr) ;
419 } ;
420 }
nkGraphics::MapResult
Contains all information of the result of a map operation on a resource.
Definition: MapResult.h:12
nkGraphics::Texture::getAutoMipGeneration
virtual bool getAutoMipGeneration() const =0
nkGraphics::RESOURCE_MISC_FLAG
RESOURCE_MISC_FLAG
Available misc flags for resources.
Definition: ResourceMiscFlag.h:12
nkGraphics::Texture::getSampleCount
virtual unsigned int getSampleCount() const =0
nkGraphics::MapRequestDescriptor
A description of a request to map a resource.
Definition: MapRequestDescriptor.h:29
nkGraphics::Texture::setFromImageCopy
void setFromImageCopy(const nkImages::ImageView &image)
nkGraphics::Texture::setFromExternalResource
virtual void setFromExternalResource(const TextureExternalData &data)=0
nkGraphics::Texture::isGammaCorrected
bool isGammaCorrected() const
nkGraphics::Texture::prepareAsCubemap
virtual void prepareAsCubemap()
nkGraphics::Texture::getTextureUsage
virtual BUFFER_USAGE getTextureUsage() const =0
nkGraphics::Texture::getMipLevels
virtual unsigned int getMipLevels() const =0
nkGraphics::System
Main interface with the component system.
Definition: System.h:14
nkGraphics::BUFFER_CPU_ACCESS_FLAG
BUFFER_CPU_ACCESS_FLAG
Available cpu access flags.
Definition: BufferCpuAccessFlag.h:12
nkGraphics::Texture::isFromFile
bool isFromFile() const
nkGraphics::Texture::freeCpuData
virtual void freeCpuData()
nkGraphics::Texture
A texture used for rendering, hosted on GPU.
Definition: Texture.h:12
nkGraphics::Texture::unmap
virtual void unmap(const UnmapRequestDescriptor &requestDesc)=0
nkGraphics::Texture::getMiscFlag
virtual RESOURCE_MISC_FLAG getMiscFlag() const =0
nkExport::Exportable
An interface to define objects that can be exported using this component.
Definition: Exportable.h:15
nkMemory::BufferView
A view over data.
Definition: BufferView.h:18
nkImages::ImageView
Holds all information required for an image, with no ownership over the data.
Definition: ImageView.h:14
nkGraphics::Texture::copyParams
virtual void copyParams(const Texture &other)=0
nkGraphics::UnmapRequestDescriptor
Description of an unmap request.
Definition: UnmapRequestDescriptor.h:19
nkGraphics::BUFFER_USAGE
BUFFER_USAGE
Available usage for buffers. Drives the memory used for hosting the data.
Definition: BufferUsage.h:12
nkGraphics::Texture::getCpuData
TextureCpuDataDescriptor * getCpuData() const
nkGraphics::Texture::getRenderFlag
TEXTURE_RENDER_FLAG getRenderFlag() const
nkGraphics::Texture::getTextureFormat
virtual FORMAT getTextureFormat() const =0
nkGraphics::Texture::generateMipChain
virtual void generateMipChain(unsigned int fromMip=0)=0
nkGraphics::Texture::setMightManuallyGenerateMip
void setMightManuallyGenerateMip(bool value)
nkGraphics::Texture::addCpuDataSliceRelativeToLast
void addCpuDataSliceRelativeToLast(unsigned int byteOffset=0u, unsigned int rowByteSize=0u, unsigned int sliceByteSize=0u)
nkGraphics::Texture::addCpuDataSlice
void addCpuDataSlice(const nkMemory::BufferView<> &data, unsigned int byteOffset=0u, unsigned int rowByteSize=0u, unsigned int sliceByteSize=0u)
nkGraphics::Texture::setMipLevels
virtual void setMipLevels(unsigned int value)=0
nkMemory::Buffer
A buffer holding binary data.
Definition: Buffer.h:32
nkGraphics::Texture::getTextureBinding
virtual BUFFER_BIND_FLAG getTextureBinding() const =0
nkGraphics::Texture::prepareAsTexture2d
virtual void prepareAsTexture2d()
nkGraphics::Texture::setDepthOrArraySize
virtual void setDepthOrArraySize(unsigned int depth)=0
nkExport::Node
A node in the tree structure representing the data to export / import.
Definition: Node.h:42
nkGraphics::Texture::addCpuDataSliceForward
void addCpuDataSliceForward(nkMemory::Buffer &&data, unsigned int byteOffset=0u, unsigned int rowByteSize=0u, unsigned int sliceByteSize=0u)
nkGraphics::Texture::setAutoMipGeneration
virtual void setAutoMipGeneration(bool value)=0
nkGraphics::Texture::importClassFromTree
virtual void importClassFromTree(nkExport::Node *rootNode) override
nkGraphics::Texture::setCpuAccessRights
virtual void setCpuAccessRights(BUFFER_CPU_ACCESS_FLAG rights)=0
nkGraphics::Texture::getCpuSliceCount
unsigned int getCpuSliceCount() const
nkGraphics::Texture::~Texture
virtual ~Texture()
nkGraphics::Texture::addCpuDataSliceCopy
void addCpuDataSliceCopy(const nkMemory::BufferView<> &data, unsigned int byteOffset=0u, unsigned int rowByteSize=0u, unsigned int sliceByteSize=0u)
nkGraphics::Texture::setCpuData
void setCpuData(const ResourceCpuDataDescriptor &data)
nkGraphics::Texture::setFromImage
void setFromImage(const nkImages::ImageView &image)
nkMemory::UniquePtr
Smart pointer owning the object instance it encapsulates.
Definition: UniquePtr.h:17
nkGraphics::Texture::setTextureUsage
virtual void setTextureUsage(BUFFER_USAGE usage)=0
nkGraphics::Texture::setHeight
virtual void setHeight(unsigned int height)=0
nkGraphics::Texture::setRenderFlag
virtual void setRenderFlag(TEXTURE_RENDER_FLAG value)
nkGraphics::TEXTURE_TYPE
TEXTURE_TYPE
The type a texture can be.
Definition: TextureType.h:12
nkGraphics::Texture::getWidth
virtual int getWidth() const =0
nkMemory::StringView
Class holding information about a string, with no ownership over the data.
Definition: StringView.h:22
nkGraphics::Texture::setGammaCorrected
virtual void setGammaCorrected(bool value)
nkGraphics::Texture::setTextureFormat
virtual void setTextureFormat(FORMAT format)=0
nkGraphics::Texture::exportClassToTree
virtual void exportClassToTree(nkExport::Node *rootNode) override
nkGraphics::Texture::getSampleQuality
virtual unsigned int getSampleQuality() const =0
nkGraphics::Texture::isBackBufferTex
bool isBackBufferTex() const
nkGraphics::Texture::getCpuAccessRights
virtual BUFFER_CPU_ACCESS_FLAG getCpuAccessRights() const =0
nkGraphics::Texture::setWidth
virtual void setWidth(unsigned int width)=0
nkGraphics::Texture::setTextureFormatFromString
void setTextureFormatFromString(nkMemory::StringView str)
nkGraphics::Texture::setPath
virtual void setPath(nkMemory::StringView value) override
nkGraphics::Texture::setBackBufferTex
void setBackBufferTex(bool value)
nkGraphics::Texture::getDepthOrArraySize
virtual int getDepthOrArraySize() const =0
nkGraphics::Texture::getNeededMipsForSize
unsigned int getNeededMipsForSize() const
nkGraphics::FORMAT
FORMAT
Available formats for resources.
Definition: DxDefinesWrapper.h:13
nkGraphics::Texture::prepareAsTexture3d
virtual void prepareAsTexture3d()
nkGraphics
Encompasses all API of component NilkinsGraphics.
Definition: BoundingBox.h:7
nkGraphics::Texture::map
virtual MapResult map(const MapRequestDescriptor &requestDesc)=0
nkGraphics::Texture::setTextureBinding
virtual void setTextureBinding(BUFFER_BIND_FLAG binding)=0
nkGraphics::ResourceGpuCopyDescriptor
Holds information about a resource copy happening on the GPU only.
Definition: ResourceGpuCopyDescriptor.h:12
nkGraphics::Texture::getHeight
virtual int getHeight() const =0
nkGraphics::Texture::create
static nkMemory::UniquePtr< Texture > create(System *system=nullptr)
nkImages::Image
Holds all information required for an image, with ownership over the data.
Definition: Image.h:14
nkGraphics::BUFFER_BIND_FLAG
BUFFER_BIND_FLAG
Available binding flags for buffers.
Definition: BufferBindFlag.h:12
nkGraphics::Texture::gpuCopyFrom
virtual void gpuCopyFrom(Texture &other, const ResourceGpuCopyDescriptor &descriptor)=0
nkGraphics::Texture::getTexType
TEXTURE_TYPE getTexType() const
nkGraphics::TextureExternalData
External texture data, allowing to inject low-level constructs within the renderers.
Definition: TextureExternalData.h:36
nkGraphics::TEXTURE_RENDER_FLAG
TEXTURE_RENDER_FLAG
The render flag possible for a texture.
Definition: TextureRenderFlag.h:12
nkGraphics::Texture::setFromImageForward
void setFromImageForward(nkImages::Image &&image)
nkGraphics::Texture::convertToImage
nkImages::Image convertToImage(int mip, int sliceOrArrayIndex)
nkGraphics::ShaderResource
Base class for shader resources. Those are resources that can be fed to a Shader.
Definition: ShaderResource.h:12